package www.openteam.com.transformer;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import www.openteam.com.base.BaseHttpResult;

/**
 * Created by kylin on 2016/12/19.
 */

public class CommonTransformer<T>
        implements Observable.Transformer<BaseHttpResult<T>,T> {
    @Override
    public Observable<T> call(Observable<BaseHttpResult<T>> baseHttpResultObservable) {
        return baseHttpResultObservable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .compose(ErrorTransformer.<T>getInstanse());
    }

}
